/*
 * Created: 2022-09-12 15:54:25
 * Author : 涛涛涛
 */

import React, { FC } from 'react';
import { View, Text, Image } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import Taro, { useRouter } from '@tarojs/taro';
import LeftTitle from './LeftTitle/LeftTitle';
export interface IProps extends ICompProps {
    /** 标题 */
    leftTitle: string;
}
LeftLogo.defaultProps = {} as Partial<IProps>;
function LeftLogo(props: IProps) {
    const { className, style, leftTitle } = props;
    const localClassName = useClassName('LeftLogo', className);
    const route = useRouter();
    /** 回首页 */
    const gotoHome = () => {
        // 如果已经在首页,则什么也不做
        if (route.path.includes('/pages/Home/Home')) return;
        // 跳转到首页
        Taro.redirectTo({
            url: 'pages/Home/Home',
        });
    };
    return (
        <RootView className={localClassName} style={style} onClick={gotoHome}>
            <View className="logo-wrap">
                <Image className="logo-img" src={require('@/assets/images/logo.png')} mode="scaleToFill"></Image>
            </View>
            <LeftTitle>{leftTitle}</LeftTitle>
            {/* <View className="title">极影藏品</View> */}
        </RootView>
    );
}
export default React.memo(LeftLogo as FC<IProps>);
const RootView = styled(View)`
    &.LeftLogo {
        display: flex;
        align-items: center;
        .logo-wrap {
            width: 80px;
            height: 80px;
            .logo-img {
                width: inherit;
                height: inherit;
            }
        }
    }
`;
